<?

    if(isset($_GET["file"])) {

        $file = urldecode($_GET["file"]);

        if(file_exists($file)) {

            if(preg_match("/\.([a-zA-Z]+)$/", $file, $matches)) { // ([\w]+)

                $type = "text/plain";

                switch($matches[1]) {

                    case "css":
                        $type = "text/css";
                        break;

                    case "js":
                        $type = "text/javascript";
                        break;

                    case "png":
                        $type = "image/png";
                        break;

                    case "gif":
                        $type = "image/gif";
                        break;

                    case "jpg":
                        $type = "image/jpeg";
                        break;

                }

                header("Content-Type: ".$type);

                echo file_get_contents($file, true);

            }
        }
        exit();
    }
?>